import { Component , Inject } from '@angular/core';
import { ReduxStore } from './store/store';
import { ReduxState } from './reducers';
import { Store } from 'redux';
import { Thread } from './models';
import { ThreadActions } from './actions';

@Component({
  selector: 'redux-main',
  templateUrl: './redux.component.html',
  styleUrls: ['./redux.component.css'],
})


export class ReduxComponent {
 	constructor( @Inject(ReduxStore) private store: Store<ReduxState> ){
 		
 		let tLadycap: Thread = {
 		  id: 'tLadycap',
 		  name: 'leo',
 		  avatarSrc:'avatarSrc',
 		  messages: []
 		};

 		let tEcho: Thread = {
 		  id: 'tEcho',
 		  name: 'echo.name',
 		  avatarSrc: 'echo.avatarSrc',
 		  messages: []
 		};

 		let tRev: Thread = {
 		  id: 'tRev',
 		  name: 'rev.name',
 		  avatarSrc: 'rev.avatarSrc',
 		  messages: []
 		};
 		
 		store.dispatch(ThreadActions.addThread(tLadycap));
 		store.dispatch(ThreadActions.addThread(tEcho));
 		store.dispatch(ThreadActions.addThread(tRev));
 	}
}
